<?php
/**
 * This file handles the retrieval and serving of news articles
 */
class Onlinemarket_Controller
{
	/**
	 * This template variable will hold the 'view' portion of our MVC for this 
	 * controller
	 */
	public $template = 'onlinemarket';
	
	/**
	 * This is the default function that will be called by router.php
	 * 
	 * @param array $getVars the GET variables posted to index.php
	 */
	public function main(array $getVars)
	{
//		$newsModel = new News_Model;
		
		//get an article
//		$article = $newsModel->get_article($getVars['author']);
		
		//create a new view and pass it our template
//		$view = new View_Model($this->template);
		
		//assign article data to view
//		$view->assign('article' , $article);
		$onlinemarketModel = new Onlinemarket_Model;
		$fresh = $onlinemarketModel->get_all_fresh();
		$ingredient = $onlinemarketModel->get_all_ingredient();
		$view = new View_Model($this->template);
		$view->assign('fresh' , $fresh);
		$view->assign('ingredient' , $ingredient);		
	}
}
